<!DOCTYPE html>
<html class="x-admin-sm">

<head>
	<meta charset="UTF-8">
	<title>电子学会比赛管理系统</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
	<link rel="stylesheet" href="./css/font.css">
	<link rel="stylesheet" href="./css/common.css">
	<link rel="stylesheet" href="./css/xadmin.css">
	<script type="text/javascript" src="./js/abkj/match/api/workappeal.js"></script>
	<script type="text/javascript" src="./js/abkj/match/api/signup.js"></script>
	<script type="text/javascript" src="./js/abkj/match/api/mathwork.js"></script>
	<script type="text/javascript" src="./js/abkj/match/api/grade.js"></script>
	<script type="text/javascript" src="./js/abkj/match/api/zone.js"></script>
	<script type="text/javascript" src="./js/abkj/match/api/tmatch.js"></script>
	<script type="text/javascript" src="./js/abkj/match/api/team.js"></script>
	<script type="text/javascript" src="./js/abkj/match/api/signup.js"></script>
	<script type="text/javascript" src="./js/abkj/auth/api/account.js"></script>
	<script type="text/javascript" src="./js/abkj/fun_tool.js"></script>
	<script type="text/javascript" src="./js/abkj/slAjax.js"></script>
	<script src="./lib/layui/layui.js" charset="utf-8"></script>
	<script type="text/javascript" src="./js/xadmin.js"></script>
</head>

<body>
<div class="x-nav">
	<span class="layui-breadcrumb">
			<a href="">首页</a>
		<a><cite>比赛管理</cite></a>
			<a><cite>申诉管理</cite></a>
	</span>
	<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
		<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
	</a>
</div>
<div class="layui-fluid" id="app">
	<div class="layui-row layui-col-space15">
		<div class="layui-col-md12">
			<div class="layui-card">
				<div class="layui-card-body ">
					<div class="layui-form layui-col-space5 flex" style="display: flex;">
						<!--<div class="layui-input-inline layui-show-xs-block">-->
						<!--<input class="layui-input" placeholder="开始日" name="start" id="start"></div>-->
						<!--<div class="layui-input-inline layui-show-xs-block">-->
						<!--<input class="layui-input" placeholder="截止日" name="end" id="end"></div>-->
						<div class="layui-input-inline layui-show-xs-block flex">
							<div class="mr5">赛项</div>
							<select name="project" id="saixiang">
								<option v-for="match in matchList" :value="match.id">{{match.theme}}</option>
							</select>
						</div>
						<!-- <div class="layui-input-inline layui-show-xs-block flex">
							<div class="mr5">赛区</div>
							<select name="division" id="saiqu">
								<option v-for="zone in zoneList" :value="zone.id">{{zone.zoneName}}</option>
							</select>
						</div> -->
						<!-- <div class="layui-input-inline layui-show-xs-block flex">
							<div class="mr5">组别</div>
							<select name="group" id="zubie">
								<option v-for="grade in gradeList" :value="grade.id">{{grade.gradeName}}</option>
							</select>
						</div>
						<div class="layui-input-inline layui-show-xs-block flex">
							<div class="mr5" style="width: 40px;">账号</div>
							<input type="text" name="number" id="zhanghao" placeholder="账号" autocomplete="off" class="layui-input"></div> -->

							<button class="layui-btn"  onclick="search1()">
								<i class="layui-icon">&#xe615;</i></button>

					</div>
				</div>
				<div class="layui-card-header">
					<!--<button class="layui-btn layui-btn-danger" onclick="delAll()">-->
						<!--<i class="layui-icon"></i>批量删除-->
					<!--</button>-->
					<!--<button class="layui-btn" onclick="xadmin.open('添加用户','./order-add.html',800,600)">-->
						<!--<i class="layui-icon"></i>添加-->
					<!--</button>-->
				</div>
				<div class="layui-card-body" id="content" v-cloak>
					<table class="layui-table layui-form" id="table">
						<span>共计{{total}}条数据</span>
						<button class="layui-btn layui-btn-sm" onclick="gongbu()" id="gongbu1"  style="float: right;">发布申诉</button>
					</table>
					<section id="page"></section>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
<script src="./js/vue.js"></script>
<script>
function  gongbu(){
	var table = layui.table
 var data=table.checkStatus('table').data
 var idstring=[]
 for (i=0;i<data.length;i++){
	 idstring.push(data[i].id)
 }
 // alert(idstring)
 if (confirm("是否发布申诉？")){
	 	PublishAppeal(idstring,function(data){
            alert("申诉公布成功！")
						location.reload()
		})
 }
}
var form
layui.use(['form', 'table'], function () {
 form = layui.form
	// layer.msg('玩命卖萌中', function(){
	//   //关闭后的操作
	//   });
	//监听提交
	form.on('submit(sreach)', function (data) {
		console.log(data)
		// layer.msg(JSON.stringify(data.field), function () {
		// location.href = 'index.html'
		// })
		return false
	})
})
	var app=new Vue({
		el: '#app',
		data: {
			workAppealList:[],
			matchWorkList:[],
			gradeList:[],
			matchList:[],
			zoneList:[],
			signUpList:[],//报名数据
			zhanghulist:[],
			list:[],
			pageNo: 1,
			pageSize: 50,
			total: 0,
			status:['审核','待审核' ,'通过', '不通过'],
			participate:['审核','参赛' ,'弃权' ],
			cols: [ //表头
				{type: 'checkbox', fixed: 'left',name:"xitong"},
				{field: 'index', title: '序号', width: 80},
				{field: 'teamId', title: '团队ID'},
				{field: 'teamName', title: '团队名称'},
				{field: 'matchName', title: '赛项'},

				{field: 'matchScheduleName', title: '赛程'},
				{field: 'content', title: '申诉内容'},
				{field: 'remark', title: '回复内容'},
				{field: 'username1', title: '回复账号'},
				{field: 'createTime', title: '申诉时间'},
				// {field: 'teacher', title: '裁判长裁决'},
				// {field: 'school', title: '学生管理会'},
				{field: 'operating', title: '操作', width: 135, templet: '#operating'},
			]
		},
		mounted: function() {
			var vm = this
			layui.use(['form', 'laypage'], function () {
				vm.form = layui.form;
			});
		},
		methods:{
			opentab:function(name,url){
				//单击事件
				console.log(name)
				console.log(url)
				xadmin.add_tab(name,url)
			},
			loadzhanghu:function(){

			},
			loadWorkAppeal:function(){
				var vm = this
				var pageParam={
					page:{
					        current: vm.pageNo, //当前页数
					        size: vm.pageSize   //每页长度
					    },
				    cond:{ //条件
					}
				}
				WorkAppealqueryList(pageParam,function(data){
				   // alert(JSON.stringify(data))
					 var data1=data
					 AccountqueryList({},function(data){
	 					console.log(JSON.stringify(data))
	 					   app.zhanghulist=data
							 app.workAppealList.records=data1;
		 					app.list = []
		 					app.total = app.workAppealList.records.length
		 					for(var i=0; i<app.workAppealList.records.length;++i){
		 						app.workAppealList.records[i].index=i;
		 						var varMatchInfo = app.getMatchFromMem(app.workAppealList.records[i].matchId)
		 						var zhanghuinfo=app.getzhanghu(app.workAppealList.records[i].judgeId)
								if (zhanghuinfo!=null){
									app.workAppealList.records[i].username1= zhanghuinfo.userName

								}
		            	// alert(varMatchInfo)
		 						app.workAppealList.records[i].matchName=varMatchInfo.theme;
		 					}
		 					app.list=app.workAppealList.records
		 				  // alert(JSON.stringify(app.workAppealList.records))
		 					layui.laypage && layui.laypage.render({
		 						elem: 'page',
		 						curr: vm.pageNo,
		 						count: vm.total,
		 						limit: vm.pageSize,
		 						jump: function (obj, first) {
		 							if (first) return
		 							vm.pageNo = obj.curr
		 							vm.loadWorkAppeal()
		 						}
		 					})
		 				},function(status,message){

		 				})
	 				})

			},
			getZoneName:function(varZoneId){
				for(var i=0; i<this.zoneList.length; ++i){
					if(this.zoneList[i].id==varZoneId){
						return this.zoneList[i].zoneName;
					}
				}
				return null;
			},
			getzhanghu:function(id){
				 // alert(this.zhanghulist.length)
				for(var i=0; i<this.zhanghulist.length; ++i){
					// alert(this.zhanghulist[i].id )
					if(this.zhanghulist[i].id == id){
						return this.zhanghulist[i];
					}
				}
			return null;
			},
			getMatchFromMem:function(varMatchId){
				for(var i=0; i<this.matchList.length; ++i){
					if(this.matchList[i].id == varMatchId){
						return this.matchList[i];
					}
				}
				return '';
			},
			getGradeName:function(varGradeId){
				for(var i=0; i<this.matchList.length; ++i){
					if(this.matchList[i].id == varGradeId){
						return this.matchList[i].theme;
					}
				}
				return null;
			},
			loadMatchWork:function(varParam){
				MathWorkqueryList(varParam,function(data){
					app.matchWorkList=data;
					var queryData = {
						in:{ // 多条件对象
				        	"attrName":"id",
				        	"data":[]
		                }
					    // page:{
					    //     current:1, //当前页数
					    //     size:10   //每页长度
					    // },
					    // cond:{ //条件
					    //     in:{ // 多条件对象
					    //     	"attrName":"id",
					    //     	"data":[]
		       //              }
					    // }
					};
					for(var i=0; i<app.matchWorkList.records.length;++i){
						queryData.in.data.push(app.matchWorkList.records[i].signupId)
					}
					if(queryData.in.data.length > 0)
						app.loadSignUpList(queryData);
				},function(status,message){

				})
			},
			getTeamInfoFromMem:function(varTeamId){
				for(var i=0; i<app.signUpList.length; ++i){
					if(app.signUpList[i].id == varTeamId){
						return app.signUpList[i];
					}
				}
				return null;
			},
			loadSignUpList:function(varParam){
				SignupqueryList(varParam,function(data){
					app.signUpList=data
				},function(status,message){
					alert(message)
				});
			},
			loadGradeList:function(){
				GradequeryList({},function(data){
					app.gradeList=data
				},function(status,message){
					alert(message)
				})
			},
			loadMatchList:function(){
				TmatchqueryList({},function(data){
					app.matchList=data
					app.loadWorkAppeal();
				},function(status,message){
					alert(message);
				})
			},
			loadZoneList:function(){
				var funTool = fun_tool();
				app.zoneList=funTool.getAdminZoneIds();
				// ZonequeryList({},function(data){
				// 	app.zoneList=data
				// },function(status,message){
				// 	alert(message);
				// })
			},
			getData(){
				var that=this
				this.loadGradeList();
				this.loadZoneList();
				this.loadMatchList();
				this.loadzhanghu()
				setTimeout(function(){
					that.init()
					form.render()
				},2000)
			},
			init:function() {
				var that = this
				layui.use(['laypage','table'], function () {
					// var laypage = layui.laypage;
					// //执行一个laypage实例
					// laypage.render({
					// 	elem: 'test1' //注意，这里的 test1 是 ID，不用加 # 号
					// 	,count: 16 //数据总数，从服务端得到
					// });
					var table = layui.table
					that.list=that.list.reverse()
				 // alert(JSON.stringify(that.list))
					//头工具栏事件
					table.render({
						elem: '#table',
						url:'',
						title: '用户数据表',
						cols: [that.cols],
						data: that.list,
						count:app.workAppealList.total
					})
				})
			}
		}
	})
	window.onload=function(){
		app.getData()
	}
	function search1(){
		  var list=[]
		  for (i=0;i<app.list.length;i++){
				var n1=app.list[i].matchName
				// alert(n1)
				if (n1==undefined||n1==null){
					n1=''
				}
				// alert(document.getElementById("saixiang").value)
				if (n1.indexOf(document.getElementById("saixiang").options[document.getElementById("saixiang").selectedIndex].text)>-1){
					list.push(app.list[i])
				}
			}
			// alert(JSON.stringify(list))
			layui.use(['laypage','table'], function () {
				// var laypage = layui.laypage;
				// //执行一个laypage实例
				// laypage.render({
				// 	elem: 'test1' //注意，这里的 test1 是 ID，不用加 # 号
				// 	,count: 16 //数据总数，从服务端得到
				// });
				var table = layui.table
			// alert(JSON.stringify(that.list))
				//头工具栏事件
				table.render({
					elem: '#table',
					url:'',
					title: '用户数据表',
					cols: [app.cols],
					data: list,
					count:app.workAppealList.total
				})
			})

	}
</script>
<script src="./js/jquery.min.js"></script>
<script type="text/html" id="operating">
	<a href="javascript:;" onclick="xadmin.open('回复申诉','reply.html?type=appeal&id='+{{d.id}}, 600, 400)" class="layui-table-link">回复申诉</a>
</script>
<script>
function initd1(){
	if (localStorage.sysroleId!='1'){
			document.getElementById("gongbu1").style.display='none'

	}
}
initd1()


</script>

</html>
